package com.hl.mapper;

import com.hl.pojo.FeeStandards;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface FeeStandardsMapper {

    @Insert("insert into fee_standards (consultation_methods, consultation_number, consultation_price, consultant_id) VALUES (#{consultationMethods}, #{consultationNumber}, #{consultationPrice}, #{consultantId})")
    Integer add(FeeStandards feeStandards);

    @Update("update fee_standards set consultation_methods = #{consultationMethods}, consultation_number = #{consultationNumber}, consultation_price = #{consultationPrice}, consultant_id = #{consultantId} where id = #{id} and del = 0 ")
    Integer update(FeeStandards feeStandards);

    @Update("update fee_standards set del = 1 where id = #{id}")
    Integer del(String id);

    @Select("select * from fee_standards where id = #{id} and del = 0")
    FeeStandards findById(String id);

    @Select("select * from fee_standards where consultation_methods = #{consultationMethods} and del = 0")
    List<FeeStandards> findByConsultationMethods(String consultationMethods);

    @Select("select * from fee_standards where consultant_id = #{consultantId} and del = 0")
    List<FeeStandards> findByConsultantId(Integer consultantId);

    @Select("select * from fee_standards where del = 0")
    List<FeeStandards> findAll();
}